# Maintainer: David Runge <dvzrv@archlinux.org>

_name=djangorestframework
pkgname=python-django-rest-framework
pkgver=3.14.0
pkgrel=2
pkgdesc="A powerful and flexible toolkit for building Web APIs."
arch=(any)
url="https://www.django-rest-framework.org/"
license=(BSD)
depends=(python-django python-pytz)
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(python-pytest python-pytest-django)
optdepends=(
  'python-django-filter: for dynamic queryset filters'
  'python-django-guardian: for a per-object permission model'
  'python-markdown: for markdown support'
  'python-psycopg2: for PostgreSQL support'
  'python-pygments: for syntax highlighting'
  'python-yaml: for YAML support'
)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha512sums=('063dde9eaaf6adede1b1ce75ec9f61581639e7f0795052019bcf9b9cc02318bd2f5fd825e6893aa2f7353c601e6792f8a52c26351bbb1e930aa841faca61f385')
b2sums=('90298354a606250688609973b6fc70b3f5c842f263d39eb3989747a43a8d492362a478dd44d920bafdd94caacdce6f2b642519a388153f8835dcc2f13abd21c1')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  pytest -vv -c /dev/null
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 LICENSE.md -t "$pkgdir/usr/share/licenses/$pkgname/"
}
